/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "transfer")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Transfer.findAll", query = "SELECT t FROM Transfer t"),
    @NamedQuery(name = "Transfer.findByTransferId", query = "SELECT t FROM Transfer t WHERE t.transferId = :transferId"),
    @NamedQuery(name = "Transfer.findByDate", query = "SELECT t FROM Transfer t WHERE t.date = :date"),
    @NamedQuery(name = "Transfer.findByOnArrival", query = "SELECT t FROM Transfer t WHERE t.onArrival = :onArrival"),
    @NamedQuery(name = "Transfer.findByActive", query = "SELECT t FROM Transfer t WHERE t.active = :active")})
public class Transfer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "transferId")
    private Integer transferId;
    @Basic(optional = false)
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Basic(optional = false)
    @Column(name = "onArrival")
    private boolean onArrival;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @JoinColumns({
        @JoinColumn(name = "packageId", referencedColumnName = "packageId"),
        @JoinColumn(name = "itemId", referencedColumnName = "itemId")})
    @ManyToOne
    private Item item;
    @JoinColumns({
        @JoinColumn(name = "Use_pharmacyId", referencedColumnName = "pharmacyId"),
        @JoinColumn(name = "Use_userId", referencedColumnName = "userId")})
    @ManyToOne
    private Userpharmacy userpharmacy;
    @JoinColumn(name = "stockId", referencedColumnName = "stockId")
    @ManyToOne
    private Stock stockId;
    @JoinColumn(name = "Sto_stockId", referencedColumnName = "stockId")
    @ManyToOne
    private Stock stostockId;
    @JoinColumns({
        @JoinColumn(name = "pharmacyId", referencedColumnName = "pharmacyId"),
        @JoinColumn(name = "userId", referencedColumnName = "userId")})
    @ManyToOne
    private Userpharmacy userpharmacy1;

    public Transfer() {
    }

    public Transfer(Integer transferId) {
        this.transferId = transferId;
    }

    public Transfer(Integer transferId, Date date, boolean onArrival, boolean active) {
        this.transferId = transferId;
        this.date = date;
        this.onArrival = onArrival;
        this.active = active;
    }

    public Integer getTransferId() {
        return transferId;
    }

    public void setTransferId(Integer transferId) {
        this.transferId = transferId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public boolean getOnArrival() {
        return onArrival;
    }

    public void setOnArrival(boolean onArrival) {
        this.onArrival = onArrival;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    public Userpharmacy getUserpharmacy() {
        return userpharmacy;
    }

    public void setUserpharmacy(Userpharmacy userpharmacy) {
        this.userpharmacy = userpharmacy;
    }

    public Stock getStockId() {
        return stockId;
    }

    public void setStockId(Stock stockId) {
        this.stockId = stockId;
    }

    public Stock getStostockId() {
        return stostockId;
    }

    public void setStostockId(Stock stostockId) {
        this.stostockId = stostockId;
    }

    public Userpharmacy getUserpharmacy1() {
        return userpharmacy1;
    }

    public void setUserpharmacy1(Userpharmacy userpharmacy1) {
        this.userpharmacy1 = userpharmacy1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (transferId != null ? transferId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transfer)) {
            return false;
        }
        Transfer other = (Transfer) object;
        if ((this.transferId == null && other.transferId != null) || (this.transferId != null && !this.transferId.equals(other.transferId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Transfer[ transferId=" + transferId + " ]";
    }
    
}
